#include "sweety_3D_Pointlight.h"
#include "tools/sweety_ProgramObject.h"

namespace SW
{
	PointLight::PointLight(MainProgramObj* shader) : Light(LightType::LightType_Point),
		m_Position(0.f), m_Ambient(0.05f, 0.05f, 0.05f), m_Diffuse(0.8f, 0.8f, 0.8f), m_Specular(1.0f, 1.0f, 1.0f),
		m_Constant(1.0f), m_Linear(0.09f), m_Quadratic(0.032f)
	{		
		m_Shader = shader;
	}

	PointLight::~PointLight()
	{

	}

	void PointLight::SetPosition(const vec3& pos, const char* shaderName)
	{
		m_Position = pos;	
		LightTool::Set(m_Shader, shaderName, pos, ValType::ValType_Vector);
	}

	vec3 PointLight::GetPosition() const
	{
		return m_Position;
	}

	void PointLight::SetAmbient(const vec3& ambient, const char* shaderName)
	{
		m_Ambient = ambient;
		LightTool::Set(m_Shader, shaderName, ambient, ValType::ValType_Vector);
	}

	vec3 PointLight::GetAmbient() const
	{
		return m_Ambient;
	}

	void PointLight::SetDiffuse(const vec3& diffuse, const char* shaderName)
	{
		m_Diffuse = diffuse;
		LightTool::Set(m_Shader, shaderName, diffuse, ValType::ValType_Vector);
	}

	vec3 PointLight::GetDiffuse() const
	{
		return m_Diffuse;
	}

	void PointLight::SetSpecular(const vec3& specular, const char* shaderName)
	{
		m_Specular = specular;
		LightTool::Set(m_Shader, shaderName, specular, ValType::ValType_Vector);
	}

	vec3 PointLight::GetSpecular() const
	{
		return m_Specular;
	}

	void PointLight::SetConstant(float constant, const char* shaderName)
	{
		m_Constant = constant;
		LightTool::Set(m_Shader, shaderName, vec3(constant), ValType::ValType_Number);
	}

	float PointLight::GetConstant() const
	{
		return m_Constant;
	}

	void PointLight::SetLinear(float linear, const char* shaderName)
	{
		m_Linear = linear;
		LightTool::Set(m_Shader, shaderName, vec3(linear), ValType::ValType_Number);
	}

	float PointLight::GetLinear() const
	{
		return m_Linear;
	}

	void PointLight::SetQuadratic(float quadratic, const char* shaderName)
	{
		m_Quadratic = quadratic;
		LightTool::Set(m_Shader, shaderName, vec3(quadratic), ValType::ValType_Number);
	}

	float PointLight::GetQuadratic() const
	{
		return m_Quadratic;
	}
}